//
//  XS_HitScrollView.swift
//  EKLWisdom
//
//  Created by 韩云智 on 2020/3/28.
//  Copyright © 2020 韩云智. All rights reserved.
//

import UIKit

open class XS_HitScrollView: UIScrollView {
//    override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? {
//        for view in subviews {
//            if let frame = view.layer.presentation()?.frame {
//                if frame.contains(point) {
//                    return view.hitTest(CGPoint(x: point.x-frame.origin.x, y: point.y-frame.origin.y), with: event)
//                }
//            }
//        }
//        return self
//    }
    open override func point(inside point: CGPoint, with event: UIEvent?) -> Bool {
        return true
    }
    open override func touchesShouldCancel(in view: UIView) -> Bool {
        if view.isKind(of: UIButton.self) {
            return true
        }
        return super.touchesShouldCancel(in: view)
    }
    open override func touchesShouldBegin(_ touches: Set<UITouch>, with event: UIEvent?, in view: UIView) -> Bool {
        if view.isKind(of: UIButton.self) {
            return true
        }
        return false
    }
}
